package com.huike.web.controller.report;


import com.huike.report.domain.vo.IndexBaseInfoVO;
import com.huike.report.domain.vo.IndexTodayInfoVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.huike.common.core.domain.AjaxResult;
import com.huike.report.service.IReportService;

import java.util.Date;

@RestController
@RequestMapping("/index")
public class IndexController {
    @Autowired
    private IReportService reportService;

    /**
     * 首页======================================基础数据统计=============================
     *
     * @param beginCreateTime
     * @param endCreateTime
     * @return
     */
    @GetMapping("/getBaseInfo")
    public AjaxResult getBaseInfo(@RequestParam("beginCreateTime") String beginCreateTime,
                                  @RequestParam("endCreateTime") String endCreateTime) {
        return AjaxResult.success(reportService.getBaseInfo(beginCreateTime, endCreateTime));
    }

    /**
     * 首页======================================今日简报=============================
     *
     * @return
     */
    @GetMapping("/getTodayInfo")
    public AjaxResult getTodayInfo() {
        /**
         * {
         *     "msg":"操作成功",
         *     "code":200,
         *     "data":{
         *         "todayCluesNum":0, //今日线索数目
         *         "todayBusinessNum":0,//今日商机数目
         *         "todayContractNum":1,//今日合同数目
         *         "todaySalesAmount":0 //今日销售金额
         *     }
         * }
         */
        IndexTodayInfoVO todayInfo = reportService.getTodayInfo();
        return AjaxResult.success(todayInfo);
    }

    /**
     * 首页======================================今日待办=============================
     *
     * @return
     */

    @GetMapping("/getTodoInfo")
    /**
     *     "msg":"操作成功",
     *     "code":200,
     *     "data":{
     *         "tofollowedCluesNum":0, //待跟进线索数目
     *         "tofollowedBusinessNum":0,//待跟进商机数目
     *         "toallocatedCluesNum":1,//待分配线索数目
     *         "toallocatedBusinessNum":0 //待分配商机数目
     */
    public AjaxResult getTodoInfo(@RequestParam("beginCreateTime") String beginCreateTime,
                                  @RequestParam("endCreateTime") String endCreateTime) {
        return AjaxResult.success(reportService.getTodoInfo(beginCreateTime, endCreateTime));
    }
}